package com.irdstudio.efp.console.service.impl;

import com.irdstudio.basic.framework.core.base.FrameworkService;
import com.irdstudio.efp.console.service.dao.VwUserDutyDao;
import com.irdstudio.efp.console.service.domain.VwUserDuty;
import com.irdstudio.efp.console.service.facade.VwUserDutyService;
import com.irdstudio.efp.console.service.vo.VwUserDutyVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *需求编号：【】（业务提的需求编号）
 *问题编号：【】（若不是因为修复问题而新增该类，则留空）
 *开发人员：【】
 *创建日期：【2019-09-2019/9/18 8:55】
 *功能描述：
 */
@Service("vwUserDutyService")
public class VwUserDutyServiceImpl implements VwUserDutyService , FrameworkService {

    private static Logger logger = LoggerFactory.getLogger(VwUserDutyServiceImpl.class);

    @Autowired
    private VwUserDutyDao vwUserDutyDao;

    @Override
    public List<VwUserDutyVO> queryAllOwner(VwUserDutyVO vwUserDutyVO) {
        logger.debug("当前查询本人所属数据信息的参数信息为:" + vwUserDutyVO);
        List<VwUserDutyVO> list = null;
        try {
            List<VwUserDuty> vwUserDutyInfos = vwUserDutyDao.queryAllOwnerByPage(vwUserDutyVO);
            logger.debug("当前查询本人所属数据信息的结果集数量为:"+ vwUserDutyInfos.size());
            pageSet(vwUserDutyInfos, vwUserDutyVO);
            list = (List<VwUserDutyVO>) beansCopy(vwUserDutyInfos, VwUserDutyVO.class);
        } catch (Exception e) {
            logger.error("数据转换出现异常!", e);
        }
        return list;
    }

    @Override
    public List<VwUserDutyVO> queryUserOrgInfo(VwUserDutyVO vwUserDutyVO) {
        logger.debug("当前查询本人所属数据信息的参数信息为:" + vwUserDutyVO);
        List<VwUserDutyVO> list = null;
        try {
            List<VwUserDuty> vwUserDutyInfos = vwUserDutyDao.queryUserOrgInfo(vwUserDutyVO);
            logger.debug("当前查询本人所属数据信息的结果集数量为:"+ vwUserDutyInfos.size());
            pageSet(vwUserDutyInfos, vwUserDutyVO);
            list = (List<VwUserDutyVO>) beansCopy(vwUserDutyInfos, VwUserDutyVO.class);
        } catch (Exception e) {
            logger.error("数据转换出现异常!", e);
        }
        return list;
    }
}
